# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=rb-inotify
pkgname=ruby-rb-inotify
pkgver=0.10.1
pkgrel=2
pkgdesc='Thorough inotify wrapper for Ruby using FFI'
url='https://github.com/guard/rb-inotify'
arch=('any')
license=('MIT')
depends=('ruby' 'ruby-ffi')
makedepends=('ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/guard/rb-inotify/archive/v${pkgver}.tar.gz)
sha256sums=('0953e27e19d48be3e41a93419f2d7a2618b36c18fe398d87e5cb1abc5a3621ea')
sha512sums=('fb8484b3c019ff471dbea57ad305c32a9d03377f8bbcb4d1631ef498b3207bc83da08889f7d43fe3a9ba54df2d9164e3a83d001797f8113ddc2e3a7f2ad9a83b')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec # don't give a fuck about rubys bla bla
  sed 's|git ls-files|find -type f|' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 README.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md"
  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"
}

# vim: ts=2 sw=2 et:
